#include "Socket.h"

Socket::Socket() {
    _fd = ::socket(AF_INET,SOCK_STREAM,0);
    if(_fd == -1){
        perror("socket");
        exit(1);
    }
}

Socket::Socket(int fd) 
:_fd(fd)
{}

int Socket::fd() {
    return _fd;
}

Socket::~Socket() {
    close(_fd);
}
